home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue37 / outlook / mapi / mapicode.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-06-19  |  16.3 KB  |  366 lines

  1. {++
  2.  
  3.   m a p i c o d e . p a s
  4.  
  5.   Abstract:
  6.  
  7.     Automatic conversion of mapicode.h.
  8.  
  9.   Comments:
  10.  
  11.     This source file automatically converted by
  12.     htrans 0.91 beta 1 Copyright (c) 1997 Alexander Staubo
  13.  
  14.   Revision history:
  15.  
  16.     18-06-1997 20:53 alex  [Autogenerated]
  17.     18-06-1997 20:53 alex  Retouched for release
  18.  
  19. --}
  20.  
  21. unit MapiCode;
  22.  
  23. interface
  24.  
  25. uses
  26.   Windows, SysUtils, ActiveX;
  27.  
  28. {!! htrans: Translated header file begins here }
  29.  
  30.  
  31. (*
  32.  *  M A P I C O D E . H
  33.  *
  34.  *  Status Codes returned by MAPI routines
  35.  *
  36.  *  Copyright 1986-1996 Microsoft Corporation. All Rights Reserved.
  37.  *)
  38.  
  39.  
  40.  
  41.  
  42. {!! htrans: Warning[9] - Ignored: #if defined (WIN32) && !defined (_WIN32) }
  43. {$DEFINE _WIN32}
  44.  
  45.  
  46. { Define S_OK and ITF_* }
  47.  
  48. {$IFDEF _WIN32}
  49. {!! htrans: Warning[9] - Ignored: #include <winerror.h> }
  50.  
  51.  
  52. (*
  53.  *  MAPI Status codes follow the style of OLE 2.0 sCodes as defined in the
  54.  *  OLE 2.0 Programmer's Reference and header file scode.h (Windows 3.x)
  55.  *  or winerror.h (Windows NT and Windows 95).
  56.  *
  57.  *)
  58.  
  59. {  On Windows 3.x, status codes have 32-bit values as follows:
  60.  *
  61.  *   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  62.  *   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  63.  *  +-+---------------------+-------+-------------------------------+
  64.  *  |S|       Context       | Facil |               Code            |
  65.  *  +-+---------------------+-------+-------------------------------+
  66.  *
  67.  *  where
  68.  *
  69.  *      S - is the severity code
  70.  *
  71.  *          0 - SEVERITY_SUCCESS
  72.  *          1 - SEVERITY_ERROR
  73.  *
  74.  *      Context - context info
  75.  *
  76.  *      Facility - is the facility code
  77.  *
  78.  *          0x0 - FACILITY_NULL     generally useful errors ([SE]_*)
  79.  *          0x1 - FACILITY_RPC      remote procedure call errors (RPC_E_*)
  80.  *          0x2 - FACILITY_DISPATCH late binding dispatch errors
  81.  *          0x3 - FACILITY_STORAGE  storage errors (STG_E_*)
  82.  *          0x4 - FACILITY_ITF      interface-specific errors
  83.  *
  84.  *      Code - is the facility's status code
  85.  *
  86.  *
  87.  }
  88.  
  89. (*
  90.  *  On Windows NT 3.5 and Windows 95, scodes are 32-bit values
  91.  *  laid out as follows:
  92.  *  
  93.  *    3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  94.  *    1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  95.  *   +-+-+-+-+-+---------------------+-------------------------------+
  96.  *   |S|R|C|N|r|    Facility         |               Code            |
  97.  *   +-+-+-+-+-+---------------------+-------------------------------+
  98.  *  
  99.  *   where
  100.  *  
  101.  *      S - Severity - indicates success/fail
  102.  *  
  103.  *          0 - Success
  104.  *          1 - Fail (COERROR)
  105.  *  
  106.  *      R - reserved portion of the facility code, corresponds to NT's
  107.  *          second severity bit.
  108.  *  
  109.  *      C - reserved portion of the facility code, corresponds to NT's
  110.  *          C field.
  111.  *  
  112.  *      N - reserved portion of the facility code. Used to indicate a
  113.  *          mapped NT status value.
  114.  *  
  115.  *      r - reserved portion of the facility code. Reserved for internal
  116.  *          use. Used to indicate HRESULT values that are not status
  117.  *          values, but are instead message ids for display strings.
  118.  *  
  119.  *      Facility - is the facility code
  120.  *          FACILITY_NULL                    0x0
  121.  *          FACILITY_RPC                     0x1
  122.  *          FACILITY_DISPATCH                0x2
  123.  *          FACILITY_STORAGE                 0x3
  124.  *          FACILITY_ITF                     0x4
  125.  *          FACILITY_WIN32                   0x7
  126.  *          FACILITY_WINDOWS                 0x8
  127.  *  
  128.  *      Code - is the facility's status code
  129.  *  
  130.  *)
  131.  
  132.  
  133.  
  134.  
  135. (*
  136.  *  We can't use OLE 2.0 macros to build sCodes because the definition has
  137.  *  changed and we wish to conform to the new definition.
  138.  *)
  139. {!! htrans: Warning[1] - Cannot handle macro define }
  140. {!! htrans: Warning[1] - Line is: #define MAKE_MAPI_SCODE(sev,fac,code) \ }
  141.  
  142.  
  143. { The following two macros are used to build OLE 2.0 style sCodes }
  144.  
  145. {!! htrans: Warning[1] - Cannot handle macro define }
  146. {!! htrans: Warning[1] - Line is: #define MAKE_MAPI_E( err )  (MAKE_MAPI_SCODE( 1, FACILITY_ITF, err )) }
  147.  
  148. {!! htrans: Warning[1] - Cannot handle macro define }
  149. {!! htrans: Warning[1] - Line is: #define MAKE_MAPI_S( warn ) (MAKE_MAPI_SCODE( 0, FACILITY_ITF, warn )) }
  150.  
  151.  
  152. {$IFDEF SUCCESS_SUCCESS}
  153. {$UNDEF SUCCESS_SUCCESS}
  154. {$ENDIF}
  155. const SUCCESS_SUCCESS      = 0;
  156.  
  157. { General errors (used by more than one MAPI object) }
  158.  
  159. const MAPI_E_CALL_FAILED                               = {!! htrans: Warning[2] - Constant value not verifiable }
  160.   E_FAIL;
  161. const MAPI_E_NOT_ENOUGH_MEMORY                         = {!! htrans: Warning[2] - Constant value not verifiable }
  162.   E_OUTOFMEMORY;
  163. const MAPI_E_INVALID_PARAMETER                         = {!! htrans: Warning[2] - Constant value not verifiable }
  164.   E_INVALIDARG;
  165. const MAPI_E_INTERFACE_NOT_SUPPORTED                   = {!! htrans: Warning[2] - Constant value not verifiable }
  166.   E_NOINTERFACE;
  167. const MAPI_E_NO_ACCESS                                 = {!! htrans: Warning[2] - Constant value not verifiable }
  168.   E_ACCESSDENIED;
  169.  
  170. const MAPI_E_NO_SUPPORT                                = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  171.    (1 shl 31) or (FACILITY_ITF shl 16) or ($102 );
  172. const MAPI_E_BAD_CHARWIDTH                             = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  173.    (1 shl 31) or (FACILITY_ITF shl 16) or ($103 );
  174. const MAPI_E_STRING_TOO_LONG                           = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  175.    (1 shl 31) or (FACILITY_ITF shl 16) or ($105 );
  176. const MAPI_E_UNKNOWN_FLAGS                             = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  177.    (1 shl 31) or (FACILITY_ITF shl 16) or ($106 );
  178. const MAPI_E_INVALID_ENTRYID                           = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  179.    (1 shl 31) or (FACILITY_ITF shl 16) or ($107 );
  180. const MAPI_E_INVALID_OBJECT                            = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  181.    (1 shl 31) or (FACILITY_ITF shl 16) or ($108 );
  182. const MAPI_E_OBJECT_CHANGED                            = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  183.    (1 shl 31) or (FACILITY_ITF shl 16) or ($109 );
  184. const MAPI_E_OBJECT_DELETED                            = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  185.    (1 shl 31) or (FACILITY_ITF shl 16) or ($10A );
  186. const MAPI_E_BUSY                                      = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  187.    (1 shl 31) or (FACILITY_ITF shl 16) or ($10 );
  188. const MAPI_E_NOT_ENOUGH_DISK                           = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  189.    (1 shl 31) or (FACILITY_ITF shl 16) or ($10D );
  190. const MAPI_E_NOT_ENOUGH_RESOURCES                      = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  191.    (1 shl 31) or (FACILITY_ITF shl 16) or ($10E );
  192. const MAPI_E_NOT_FOUND                                 = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  193.    (1 shl 31) or (FACILITY_ITF shl 16) or ($10F );
  194. const MAPI_E_VERSION                                   = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  195.    (1 shl 31) or (FACILITY_ITF shl 16) or ($110 );
  196. const MAPI_E_LOGON_FAILED                              = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  197.    (1 shl 31) or (FACILITY_ITF shl 16) or ($111 );
  198. const MAPI_E_SESSION_LIMIT                             = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  199.    (1 shl 31) or (FACILITY_ITF shl 16) or ($112 );
  200. const MAPI_E_USER_CANCEL                               = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  201.    (1 shl 31) or (FACILITY_ITF shl 16) or ($113 );
  202. const MAPI_E_UNABLE_TO_ABORT                           = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  203.    (1 shl 31) or (FACILITY_ITF shl 16) or ($114 );
  204. const MAPI_E_NETWORK_ERROR                             = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  205.    (1 shl 31) or (FACILITY_ITF shl 16) or ($115 );
  206. const MAPI_E_DISK_ERROR                                = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  207.    (1 shl 31) or (FACILITY_ITF shl 16) or ($116 );
  208. const MAPI_E_TOO_COMPLEX                               = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  209.    (1 shl 31) or (FACILITY_ITF shl 16) or ($117 );
  210. const MAPI_E_BAD_COLUMN                                = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  211.    (1 shl 31) or (FACILITY_ITF shl 16) or ($118 );
  212. const MAPI_E_EXTENDED_ERROR                            = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  213.    (1 shl 31) or (FACILITY_ITF shl 16) or ($119 );
  214. const MAPI_E_COMPUTED                                  = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  215.    (1 shl 31) or (FACILITY_ITF shl 16) or ($11A );
  216. const MAPI_E_CORRUPT_DATA                              = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  217.    (1 shl 31) or (FACILITY_ITF shl 16) or ($11 );
  218. const MAPI_E_UNCONFIGURED                              = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  219.    (1 shl 31) or (FACILITY_ITF shl 16) or ($11C );
  220. const MAPI_E_FAILONEPROVIDER                           = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  221.    (1 shl 31) or (FACILITY_ITF shl 16) or ($11D );
  222. const MAPI_E_UNKNOWN_CPID                              = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  223.    (1 shl 31) or (FACILITY_ITF shl 16) or ($11E );
  224. const MAPI_E_UNKNOWN_LCID                              = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  225.    (1 shl 31) or (FACILITY_ITF shl 16) or ($11F );
  226.  
  227. { Flavors of E_ACCESSDENIED, used at logon }
  228.  
  229. const MAPI_E_PASSWORD_CHANGE_REQUIRED                  = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  230.    (1 shl 31) or (FACILITY_ITF shl 16) or ($120 );
  231. const MAPI_E_PASSWORD_EXPIRED                          = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  232.    (1 shl 31) or (FACILITY_ITF shl 16) or ($121 );
  233. const MAPI_E_INVALID_WORKSTATION_ACCOUNT               = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  234.    (1 shl 31) or (FACILITY_ITF shl 16) or ($122 );
  235. const MAPI_E_INVALID_ACCESS_TIME                       = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  236.    (1 shl 31) or (FACILITY_ITF shl 16) or ($123 );
  237. const MAPI_E_ACCOUNT_DISABLED                          = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  238.    (1 shl 31) or (FACILITY_ITF shl 16) or ($124 );
  239.  
  240. { MAPI base function and status object specific errors and warnings }
  241.  
  242. const MAPI_E_END_OF_SESSION                            = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  243.    (1 shl 31) or (FACILITY_ITF shl 16) or ($200 );
  244. const MAPI_E_UNKNOWN_ENTRYID                           = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  245.    (1 shl 31) or (FACILITY_ITF shl 16) or ($201 );
  246. const MAPI_E_MISSING_REQUIRED_COLUMN                   = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  247.    (1 shl 31) or (FACILITY_ITF shl 16) or ($202 );
  248. const MAPI_W_NO_SERVICE                                = {!! htrans: [MAPI MAKE_MAPI_S macro] }
  249.    (FACILITY_ITF shl 16) or ($203 );
  250.  
  251. { Property specific errors and warnings }
  252.  
  253. const MAPI_E_BAD_VALUE                                 = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  254.    (1 shl 31) or (FACILITY_ITF shl 16) or ($301 );
  255. const MAPI_E_INVALID_TYPE                              = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  256.    (1 shl 31) or (FACILITY_ITF shl 16) or ($302 );
  257. const MAPI_E_TYPE_NO_SUPPORT                           = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  258.    (1 shl 31) or (FACILITY_ITF shl 16) or ($303 );
  259. const MAPI_E_UNEXPECTED_TYPE                           = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  260.    (1 shl 31) or (FACILITY_ITF shl 16) or ($304 );
  261. const MAPI_E_TOO_BIG                                   = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  262.    (1 shl 31) or (FACILITY_ITF shl 16) or ($305 );
  263. const MAPI_E_DECLINE_COPY                              = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  264.    (1 shl 31) or (FACILITY_ITF shl 16) or ($306 );
  265. const MAPI_E_UNEXPECTED_ID                             = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  266.    (1 shl 31) or (FACILITY_ITF shl 16) or ($307 );
  267.  
  268. const MAPI_W_ERRORS_RETURNED                           = {!! htrans: [MAPI MAKE_MAPI_S macro] }
  269.    (FACILITY_ITF shl 16) or ($380 );
  270.  
  271. { Table specific errors and warnings }
  272.  
  273. const MAPI_E_UNABLE_TO_COMPLETE                        = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  274.    (1 shl 31) or (FACILITY_ITF shl 16) or ($400 );
  275. const MAPI_E_TIMEOUT                                   = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  276.    (1 shl 31) or (FACILITY_ITF shl 16) or ($401 );
  277. const MAPI_E_TABLE_EMPTY                               = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  278.    (1 shl 31) or (FACILITY_ITF shl 16) or ($402 );
  279. const MAPI_E_TABLE_TOO_BIG                             = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  280.    (1 shl 31) or (FACILITY_ITF shl 16) or ($403 );
  281.  
  282. const MAPI_E_INVALID_BOOKMARK                          = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  283.    (1 shl 31) or (FACILITY_ITF shl 16) or ($405 );
  284.  
  285. const MAPI_W_POSITION_CHANGED                          = {!! htrans: [MAPI MAKE_MAPI_S macro] }
  286.    (FACILITY_ITF shl 16) or ($481 );
  287. const MAPI_W_APPROX_COUNT                              = {!! htrans: [MAPI MAKE_MAPI_S macro] }
  288.    (FACILITY_ITF shl 16) or ($482 );
  289.  
  290. { Transport specific errors and warnings }
  291.  
  292. const MAPI_E_WAIT                                      = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  293.    (1 shl 31) or (FACILITY_ITF shl 16) or ($500 );
  294. const MAPI_E_CANCEL                                    = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  295.    (1 shl 31) or (FACILITY_ITF shl 16) or ($501 );
  296. const MAPI_E_NOT_ME                                    = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  297.    (1 shl 31) or (FACILITY_ITF shl 16) or ($502 );
  298.  
  299. const MAPI_W_CANCEL_MESSAGE                            = {!! htrans: [MAPI MAKE_MAPI_S macro] }
  300.    (FACILITY_ITF shl 16) or ($580 );
  301.  
  302. { Message Store, Folder, and Message specific errors and warnings }
  303.  
  304. const MAPI_E_CORRUPT_STORE                             = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  305.    (1 shl 31) or (FACILITY_ITF shl 16) or ($600 );
  306. const MAPI_E_NOT_IN_QUEUE                              = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  307.    (1 shl 31) or (FACILITY_ITF shl 16) or ($601 );
  308. const MAPI_E_NO_SUPPRESS                               = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  309.    (1 shl 31) or (FACILITY_ITF shl 16) or ($602 );
  310. const MAPI_E_COLLISION                                 = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  311.    (1 shl 31) or (FACILITY_ITF shl 16) or ($604 );
  312. const MAPI_E_NOT_INITIALIZED                           = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  313.    (1 shl 31) or (FACILITY_ITF shl 16) or ($605 );
  314. const MAPI_E_NON_STANDARD                              = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  315.    (1 shl 31) or (FACILITY_ITF shl 16) or ($606 );
  316. const MAPI_E_NO_RECIPIENTS                             = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  317.    (1 shl 31) or (FACILITY_ITF shl 16) or ($607 );
  318. const MAPI_E_SUBMITTED                                 = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  319.    (1 shl 31) or (FACILITY_ITF shl 16) or ($608 );
  320. const MAPI_E_HAS_FOLDERS                               = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  321.    (1 shl 31) or (FACILITY_ITF shl 16) or ($609 );
  322. const MAPI_E_HAS_MESSAGES                              = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  323.    (1 shl 31) or (FACILITY_ITF shl 16) or ($60A );
  324. const MAPI_E_FOLDER_CYCLE                              = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  325.    (1 shl 31) or (FACILITY_ITF shl 16) or ($60 );
  326.  
  327. const MAPI_W_PARTIAL_COMPLETION                        = {!! htrans: [MAPI MAKE_MAPI_S macro] }
  328.    (FACILITY_ITF shl 16) or ($680 );
  329.  
  330. { Address Book specific errors and warnings }
  331.  
  332. const MAPI_E_AMBIGUOUS_RECIP                           = {!! htrans: [MAPI MAKE_MAPI_E macro] }
  333.    (1 shl 31) or (FACILITY_ITF shl 16) or ($700 );
  334.  
  335. { The range 0x0800 to 0x08FF is reserved }
  336.  
  337. { Obsolete typing shortcut that will go away eventually. }
  338. {$IFNDEF MakeResult}
  339. {!! htrans: Warning[1] - Cannot handle macro define }
  340. {!! htrans: Warning[1] - Line is: #define MakeResult(_s)  ResultFromScode(_s) }
  341.  
  342. {$ENDIF}
  343.  
  344. { We expect these to eventually be defined by OLE, but for now,
  345.  * here they are.  When OLE defines them they can be much more
  346.  * efficient than these, but these are "proper" and don't make
  347.  * use of any hidden tricks.
  348.  }
  349. {$IFNDEF HR_SUCCEEDED}
  350. {!! htrans: Warning[1] - Cannot handle macro define }
  351. {!! htrans: Warning[1] - Line is: #define HR_SUCCEEDED(_hr) SUCCEEDED((SCODE)(_hr)) }
  352.  
  353. {!! htrans: Warning[1] - Cannot handle macro define }
  354. {!! htrans: Warning[1] - Line is: #define HR_FAILED(_hr) FAILED((SCODE)(_hr)) }
  355.  
  356. {$ENDIF}
  357.  
  358. {$ENDIF}  {} 
  359.  
  360. {!! htrans: Translated header file ends here }
  361.  
  362. implementation
  363.  
  364. end.
  365.  
  366.